
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include <EGL/eglplatform.h>

#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#include <GLES2/gl2platform.h>

//#include <GLES/gl.h>
//#include <GLES/glext.h>
//#include <GLES/glplatform.h>

#include "../base/Draw_Base.h"

#ifndef _EGL_BASE_H
#define _EGL_BASE_H


/** 配置数组的类型定义 */
typedef float CONFTYPE;


/**
 *  config info
 */
struct EGL_Base_Conf : public Draw_Base_Conf{
    // 配置数组
    CONFTYPE* m_tConfs;
    // display
    EGLDisplay m_vEglDisplay;
    EGLConfig m_vEglConfig;
    EGLContext m_vEglContext;
    EGLSurface m_vEglSurface;
    // sign for init
    EGLBoolean m_bSuccess;
    // egl configure's num
    EGLint m_nNumConfigs;
    //egl‘s version
    EGLint m_nMajorVersion;
    //minor's version
    EGLint m_nMinorVersion;
    //
    EGLint m_nScreenWidth, m_nScreenHeight;
        
    EGL_Base_Conf();
    
};

class EGL_Base  : public Draw_Base
{
public:

	//void loadInfo(JNIEnv * env, const char* argProc, jobject argImg, struct DrawInfo* argDtawInfoPtr);
        
        /**
         * init and conf display
         */
        void initDisplay();
        
	/**
	 * init window
	 */
        void initWindowSurface(struct android_app* a_sApp);
	
	void initPBufferSurface();
	
	/**
	 * use all
	 */
	void makeCurrent();
	/**
	 * destroy:display context surface ...
	 * release everything
	 */
	int Release();
	
	/**
	 * swap buffer for drawing
	 */
	void swapBuffer();

	/**
         * construction
         * init conf-file
         */
	EGL_Base();
private:

    EGL_Base_Conf* m_sEGL_Base_Conf;
    
};

#endif





